package com.alks.common.ratelimit.annotation;

import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimit {
    /**
     * The maximum number of requests allowed within the specified time window.
     */
    long limit();

    /**
     * The time window for the rate limit, in the specified time unit.
     */
    long timeout();

    /**
     * The time unit for the timeout.
     */
    TimeUnit timeUnit() default TimeUnit.SECONDS;

    /**
     * The key prefix for the rate limit. This can be used to differentiate between different rate limits.
     */
    String key() default "";

    /**
     * The error message to return when the rate limit is exceeded.
     */
    String message() default "Too many requests, please try again later.";
}